Skip to content

docs(guardrails): say how PII redaction works on streaming requests - #1168

Open
ninadphalak wants to merge 2 commits into
Portkey-AI:mainfrom
ninadphalak:docs/pii-redaction-streaming
Open

ninadphalak wants to merge 2 commits into
Portkey-AI:mainfrom
ninadphalak:docs/pii-redaction-streaming

Conversation

@ninadphalak

Copy link
Copy Markdown

The PII redaction page says the same guardrail can go in after_request_hooks to redact PII in LLM responses. It doesn't say what happens when the request streams, and that page is where I'd look first.

The guardrails page already answers it under Streaming Responses. Output guardrails run on the full response after the stream ends, and on streaming no action is taken. So a streamed response reaches the client unredacted, and the verdict only shows up in hook_results.

I added a short note under the existing one on the PII redaction page, and the same note on the copy under aigw/. It links to that section and says to use stream: false when the response has to be redacted. In the open-source gateway, responseHandlers.ts returns the stream on a streaming request before the after-request hooks run.

The second paragraph of the note links the OWASP AI Exchange section on streamed output and a report I wrote on the same problem. If you'd rather keep the note to Portkey's own behaviour, I'll drop that paragraph.

@mintlify

mintlify Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit bb140fe.

Approve preview

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant